<template>
  <div>
    <ul>
      <li v-for="(val, index) in arr" :key="index">{{ val }}</li>
    </ul>
    <button @click="btn1">排序</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [5, 10, 3, 2, 6],
    };
  },
  methods: {
    btn1() {
      this.arr.sort((a, b) => a - b);
    },
  },
};
</script>

<style>
</style>